package com.jdrx.sw.sewage.api.app;

import com.jdrx.platform.commons.rest.beans.vo.ResponseVO;
import com.jdrx.platform.commons.rest.exception.BizException;
import com.jdrx.platform.commons.rest.factory.ResponseFactory2;
import com.jdrx.sw.sewage.beans.vo.DeviceDateDisplayVO;
import com.jdrx.sw.sewage.beans.vo.GroupDeviceDisplayVO;
import com.jdrx.sw.sewage.common.constant.Constant;
import com.jdrx.sw.sewage.service.GatherDevPoiServiceImpl;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping(value = "/api/app/stationflowchart")
@Api(value = "app-厂站管理-工艺流程")
public class StationFlowAppChartApi {
    @Autowired
    private GatherDevPoiServiceImpl gatherDevPoiServiceImpl;

    @ApiOperation(value = "根据站点id查询设备展示信息")
    @RequestMapping(value = "findDisplayByStationId", method = RequestMethod.GET)
    public ResponseVO<List<GroupDeviceDisplayVO>> findDisplayVOByStationId(@RequestHeader(Constant.DATA_NODE) String dataNode,
                                                                           @RequestHeader(Constant.TENANT_ID) String tenantId,
                                                                           @RequestParam Long stationId) throws BizException {
        return ResponseFactory2.ok(gatherDevPoiServiceImpl.findDisplayVOByStationId(stationId, null));
    }

    @ApiOperation(value = "根据站点id和工艺单元id查询设备展示信息")
    @RequestMapping(value = "findDisplayByProcessunitId", method = RequestMethod.GET)
    public ResponseVO<List<DeviceDateDisplayVO>> findDisplayVOByStationIdAndProcessunitId(@RequestHeader(Constant.DATA_NODE) String dataNode,
                                                                                          @RequestHeader(Constant.TENANT_ID) String tenantId,
                                                                                          @RequestParam Long stationId,
                                                                                          @RequestParam Long processunitId) throws BizException {
        return ResponseFactory2.ok(gatherDevPoiServiceImpl.findDisplayVOByStationIdAndProcessunitId(stationId, null, processunitId));
    }

    @ApiOperation(value = "查询站点下所有参数设置")
    @RequestMapping(value = "findParSetByStationId", method = RequestMethod.GET)
    public ResponseVO<List<GroupDeviceDisplayVO>> findParSetByStationId(@RequestHeader(Constant.DATA_NODE) String dataNode,
                                                                        @RequestHeader(Constant.TENANT_ID) String tenantId,
                                                                        @RequestParam Long stationId) throws BizException {
        return ResponseFactory2.ok(gatherDevPoiServiceImpl.findParSetByStationId(stationId));
    }

    @ApiOperation(value = "查询站点下所有摄像头")
    @RequestMapping(value = "findCameraByStationId", method = RequestMethod.GET)
    public ResponseVO<Object> findCameraByStationId(@RequestHeader(Constant.DATA_NODE) String dataNode,
                                                    @RequestHeader(Constant.TENANT_ID) String tenantId,
                                                    @RequestParam Long stationId) throws BizException {
        return ResponseFactory2.ok(gatherDevPoiServiceImpl.findCameraByStationId(stationId));
    }

    /*@ApiOperation(value = "修改设备参数值")
    @RequestMapping(value = "update", method = RequestMethod.POST)
    public ResponseVO updateByVO(@RequestHeader(Constant.DATA_NODE) String dataNode,
                                 @RequestHeader(Constant.TENANT_ID) String tenantId,
                                 @RequestHeader(Constant.UID) String uid,
                                 @RequestBody GatherParVO vo) throws BizException, InterruptedException {
    	vo.setLogTerminal(ELogTerminal.APP.getKey());
    	gatherDevPoiServiceImpl.updateByVO(vo, tenantId, uid);
        return ResponseFactory2.ok();
    }*/
}
